package com.xyd.util;

import java.io.FileWriter;
import java.io.IOException;

/*
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

/**
 * @author zjz
 */
public class AlipayConfig {

  // ↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

  /** 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号 */
  public static String app_id = "2021000116699116";

  /** 商户私钥，您的PKCS8格式RSA2私钥 */
  public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCuRKBe9QkcU1Iu0WtqaMziWGbsmkE89f4bcT9I69OD+RPWUNuAPXqsBOpuMA2pk6MzKGq557RK325tNNHoz67tReivO9WLUt1YP/omeLB6IIPfxiClRk68CqUHzyYSAeSyM3ujl0VVBowKWsmpqbUwASbBQjI+GAb7mvfRKk6+n7lWHk72cWlyj2IQCeFbweAYbRF7/8VORPueu4mWAnqwwtRdwuKtgKa7s2/rXamKNMsELtvG8QVjRRdYLLzNGH+wLwH5kDQ77cuqgCTOreSMPll4yVYEK7hUIEFM1eU7yTp4xo8X15Pzq4FM3XyNm4y1lchu2S5/f36MA41PKiILAgMBAAECggEBAId0xmco9gzzYvULSQAsN91UM6SDfmQhHYQ9MaC/1ehGKjozHXr/zqN5KrO9XFFMddVk/BhG1yg/pfjyzpq1G9ZIucXDr4gdP/nBuPJAa4RyU68TtPpivP6DE6YPSRtEJ3ywcdFF2tltPlsqGIhtZm3K51He32jOilb2LNyDkzOtbY1o7K9ObD3CzJrDKo9iIyBfDDqvWOfJCDX5AVG/BW49I/FqABuvpuoe6A7K/ptS8+ps25aLc82ndbNQA+3fexRMxM9mbNX52n9L+T1a4vWCz2/an/+cNYc1U8QRCD7vCeqZFTFnXR1gquW+H3QA98OtZ+7xsc4pOsd7AOswf4kCgYEA9PPFWulL7tGJ26RZ9k151BraRXjxZkiB+6qg+mG148fcdvoLcW5s4TfWo050Ze5XnxyRzBZJP0oUlYsZeBZVuBt5Pc+ODbYY41zZ4R82oglnl1sXleJ7WNEeyvcYVBSqFxC3SUPXMzrboum8qXACqSYhBq8+pPXq1XhRXiOmdl0CgYEAtiC7sTy5/2EtrSYUyrblWZsIubiC24RAfA+yfxvvKTaroHNzkkj7yYbJxvNnSNqRf1wqC129oKxtkGqIgA9GzX3s7052LR02yQJfDnbsmMfPFvjP/T1SnPSZ35SRv7A6kVwIqQ15c+PizuG5ODdmkMSxzXYA0ifOUUJX1IfPI4cCgYEAsErNjBuB4dR+0kxbzs990fCtjPh5THL80eLAztMJ9HDANATLvYyK4iCs4oWxcjbyavpF2Etl1h376JDe+LWiZcmoHZtGkomvKduGl+Y+DKqWGrGdrOr+eTKwZcUmhkUFEWqfbyRbOmyu7HYqqQuLbq+Zb1Uq0dCHfbGFZipkQKUCgYB50395WQOZniltjvGNf7X+sEOv54owyFBSLDXb7JWX3egD1fZSvdsevLiwChTmmL2GkeHV5Ih5t506YuiXsKBNyJP6p2NJXidNYfavuEEfGVifJyQJY0Gll8Bt2/V6YalrnkJ0wnyhVqhadobs4bIL2GaO5wY5jULm/BfAJHAcdQKBgQCpuOEAPNiMukxs/GYf7eH1BPTzaF36DXpEoqFeU7hRJ5Hza7kKg5lbeEcEVHhXH64ACyGPu9ulFdQdZI1thQWklJLfsmHBiikrVsHo4m5g9N+6MCNzoMTx3d7ph1NI+ZmGKmRJPq3Ecz7eLAetp1kOjKRToUuE2R5HYE5YabN2FQ==";

  /** 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。 */
  public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqVcfwle2mxylXLDZh1wmt+qrnEOCqS4QDK34U5REifKxyhcFEH4W/kOXDe0jTQYWGsvLAeoWLvwXkz60Cl6aua/I0dYmOm7NQf2222FEPwOz9x5LQP+xu8hV8U2GAfMdPkd8sHUAMrvUmOgtmSydidkITyF2G/s/unDCM7101SKnBJ4XYrrwzcJyveUPLtvu/+fF7uBuQXJMFUHprilfqVRuelPEwqXoYx6gkKyvraKpYMYn3uzYk5wrYgJ0tUabCc8AuD7Dl0g2hAVhXD2kZBY2kikK10YZpKS4V4fzwsShPYu8u0SW7KAMjbdn7/X4vIL2ukwi7NgLPqWeZPX9jwIDAQAB";

  /** 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问 */
  public static String notify_url = "http://localhost:8080/shopping-result.html";

  /** 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问 */
  public static String return_url = "http://localhost:8080/shopping-result.html";

  /** 签名方式 */
  public static String sign_type = "RSA2";

  /** 字符编码格式 */
  public static String charset = "utf-8";

  /** 支付宝网关 */
  public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

  /** 支付宝网关 */
  public static String log_path = "C:\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

  /**
   * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
   *
   * @param sWord 要写入日志里的文本内容
   */
  public static void logResult(String sWord) {
    FileWriter writer = null;
    try {
      writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
      writer.write(sWord);
    } catch (Exception e) {
      e.printStackTrace();
    } finally {
      if (writer != null) {
        try {
          writer.close();
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
  }
}

